<div class="header"> 
    <h1 class="page-header">
        申请报名
    </h1>
    <ol class="breadcrumb">
        <li><a href="#">首页</a></li>
        <li class="active"><a href="#">申请报名的列表</a></li>
    </ol> 

</div>
<div id="page-inner">
    <!-- 内容开始 -->
    <div class="row">

        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                列表
                </div> 
                <div class="panel-body"> 
                    <div class="dataTables_wrapper form-inline">
                        <form class="row" action="{:U('Contact/index')}" method="post">
                            <div class="col-sm-6">
                                <div class="dataTables_filter">
                                    <label>查询:<input class="form-control input-sm" aria-controls="dataTables-example" type="search" placeholder="输入查询姓名" name="keyword"></label>
                                    <input type="submit" class="btn btn-primary" value="查询">
                                </div>
                            </div>
                        </form>
                        <table class="table">
                          <thead>
                            <tr>
                              <th>id</th>
                              <th>姓名</th>
                              <th>性别</th>
                              <th>年龄</th>
                              <th>qq</th>
                              <th>意向课程</th>
                              <th>电话</th>
                              <!-- <th>邮箱</th> -->
                              <th>操作</th>
                            </tr>
                          </thead>
                          <tbody>
                            <?php foreach($contactList as $k=>$v){?>
                            <tr <?php if($v['isread']){ ?>class="success" <?php } ?>>
                              <td><?php echo $v['id'] ?></td>
                              <td><?php echo $v['name'] ?></td>
                              <td><?php echo $v['gender']==0?"女":"男"; ?></td>
                              <td><?php echo $v['age'] ?></td>
                              <td><?php echo $v['qq'] ?></td>
                              <td><?php echo $v['mname'] ?></td>
                              <td><?php echo $v['phone'] ?></td>
                              <!-- <td><?php echo $v['email'] ?></td> -->
                              <td>
                                <a href="javascript:void(0);" onclick="changeRead(<?php echo $v['id'] ?>,this)">已阅</a>
                                <a href="<?php echo U('Contact/del',array('id'=>$v['id']));?>" onclick="return confirm('是否删除')?true:false;">删除</a>
                              </td>
                            </tr>
                            <?php }?>
                          </tbody>
                        </table>
                        <div class="page">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>                      
    </div>
    <!-- 内容结束 -->

</div>
<!-- /. PAGE INNER  -->
<script>
    function changeRead(id,obj){
      $.ajax({
        url: "{:U('Contact/isread')}",
        type: 'post',
        data: {id: id},
        success:function(data){
          if(data){
            $(obj).parents('tr').addClass('success');
          }
        }
      })
    }
</script>